package com.yulintu.common;

import com.yulintu.dao.BaseBodyDaoService;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;

/**
 * @author caomin
 * @date 2017/10/27
 * @说明
 */
public class StartDaoParser implements Runnable {

    @Override
    public void run() {
        ProcessManager instance = ProcessManager.getProcessManager();
        ArrayBlockingQueue<BaseBodyDaoService> baseBodyDaoServices = instance.getBaseBodyDaoServices();
        ExecutorService threadPool = instance.getThreadPool();
        System.out.println("处理baseBodyDaoServices的阻塞队列，一有数据就开始处理");
        while (true){
            try {
                BaseBodyDaoService take = baseBodyDaoServices.take();
                //执行方法
                threadPool.execute(take);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
